package com.example.biyesheji.controller;

import com.example.biyesheji.model.param.ThreeMonthSales;
import com.example.biyesheji.model.result.TrendAnalze;
import com.example.biyesheji.service.ThreeMonthSaleService;
import org.apache.spark.sql.sources.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.GET;
import java.util.List;
import java.util.Random;

@RestController
@RequestMapping("/product")
public class RandomThreeMonthSaleController {

    @Autowired
    private ThreeMonthSaleService threeMonthSaleService;

    @CrossOrigin
    @GetMapping("/threemonth/{id}")
    public ThreeMonthSales getThreeMonthSale(@PathVariable String id){
       return threeMonthSaleService.getSaleList(id);
    }


    @CrossOrigin
    @GetMapping("/moreinfo/{id}")
    public TrendAnalze moreInfo(@PathVariable String id){
       return threeMonthSaleService.getMoreInfo(id);
    }

    //未使用
    @GetMapping("/tmp")
    public String getName(String name){
        System.out.println(name);
        return name;
    }
    //丢弃
    @GetMapping("/item/{type}/{page}")
    public String getParvalue(@PathVariable("type") String type, @PathVariable("page")Integer page){
        return "类型:"+type+"页数"+page;
    }
}
